package com.ehome.poct.core.api.constant.enums;


import com.ehome.exception.BizException;

/**
 * 支付类型枚举
 * @author 瑶苏
 * @since 2021/09/23 17:26
 */
public enum PayTypeEnum {
    //普通订单
    All_PAY(10,"allPay"),
    //优惠券方式
    COUPON_PAY(11,"couponPay"),
    //打折方式
    DISCOUNT_PAY(12,"discountPay"),
    //满减方式
    MAN_JIAN_PAY(13,"manJianPay"),
    //第三方合作方式
    PARTNER_PROMOTION_PAY(14,"partnerPromotionPay"),
    //免费方式 -赠送，测试，样机
    FREE_PAY(20,"freePay"),
    //免费方式 -买断
    FREE_MAIDUAN_PAY(21,"freePay"),
    ;
    private  Integer type;
    private   String serviceName;
    PayTypeEnum(Integer payType, String className){
        type = payType;
        serviceName = className;
    }

    public int getType() { return type; }

    public void setType(int type) { this.type = type; }

    public String getServiceName() { return serviceName; }

    public void setServiceName(String serviceName) { this.serviceName = serviceName; }

    public static PayTypeEnum getEnum(int type){
        for(PayTypeEnum payType : values()){
            if(payType.getType() == type){
                return payType;
            }
        }
        throw new BizException(40000000,"没有找到对应的支付类型！");
    }
}
